package com.itheima.user.sentinel;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description:
 * @Version: V1.0
 */
@Component
public class IPLimiter implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
        System.out.println("addr = "+httpServletRequest.getRemoteAddr());
        return httpServletRequest.getRemoteAddr();
    }
}
